package refercese;

import java.util.function.Function;

import org.junit.Test;

interface MyFunc<T1,T2,R>{
	R apply(T1 t1,T2 t2);
}

public class SpecialRefDemo {
	@Test
	public void test1() {
		"abc".length();  // 非静态方法
		
		//R apply(T)                 类名::非静态方法
		Function<String,Integer> f = String::length;
		Integer apply = f.apply("abc");       // "abc".length();
		
		MyFunc<String,Integer,String> mf = String::substring;
		System.out.println(mf.apply("hello world", 3));
		
		// contains  <对象String,参数String,返回值Boolean>
		MyFunc<String,String,Boolean> mf2 = String::contains;
		System.out.println(mf2.apply("hello world", "world"));
	}	
}
